#include "widget_score_graph.h"
#include "players.h"



score_graph_widget::score_graph_widget( vector< vector< double > >* data, QWidget* parent ): Plot( "Players tactics comparison", "Round number", "Score", true, parent )
{
	this->setWindowTitle( "AI Tester - Players tactics comparison" );

	size = data->size();
	players_score = new QwtPlotCurve*[ size ];
	for ( unsigned int i = 0; i < size; ++i )
	{
		players_score[ i ] = new QwtPlotCurve( players::get_instance()->get_player( i )->get_name().c_str() );
		players_score[ i ]->setRenderHint( QwtPlotItem::RenderAntialiased );
		players_score[ i ]->setPen( QPen( game_gui::get_instance()->graphics->get_QColor( i ) ) );
		players_score[ i ]->attach( this );
		players_score[ i ]->setData( GraphData( &( ( *data )[ i ] ) ) );
	};
};



score_graph_widget::~score_graph_widget()
{
	for ( unsigned int i = 0; i < size; ++i )
	{
		delete players_score[ i ];
	}
	delete [] players_score;
};